const express=require('express');
const mysql=require('mysql');
const urlobj=require('url');
//引用自定义
const commte=require('../../../libs/common.js');
//链接数据库
var db=mysql.createPool({
    host:'localhost',
    user:'root',
    password:'',
    database:'leasedb'
});
//业务逻辑
module.exports = function() {
    var router = express.Router();

    router.get('/displacritical.html',function (req,res,next) {
        db.query("SELECT * FROM commentinfo, userinfo, classc WHERE commentinfo.classCId = classc.classCId AND commentinfo.userId = userinfo.userId  and commentinfo.commentId="+ +req.query.commentId+"",function (err,data) {
            if(err)
            {
                res.status(500).send('<script>alert("查询出错了!");window.location.href="404.html";</script>').end();
            }else
            {
                if(data.length==0)
                {
                    res.status(100).send('<script>alert("占时没有数据!");window.location.href="ertiaryGoods.html";</script>').end();
                }else
                {
                    req.activityid=data;

                    next();
                }
            }
        })

    });
    router.get('/displacritical.html',function(req,res){
        res.render("admin/displacritical.ejs",{activityinfo:req.activityid});
    });
    return router;
}